****Three-State Do.file

***Creates the dependent variable

egen dv_1=rmean(Q4 Q101 Q106 Q111)
gen dv=7-dv_1


**creates indicator variables for cells (1= control, 2= gain, 3= neutral, 4=loss)

gen cell1=0
gen cell2=0
gen cell3=0
gen cell4=0

replace cell1=1 if Q4 <=7
replace cell2=1 if Q101 <=7
replace cell3=1 if Q106 <=7
replace cell4=1 if Q111 <=7


****creates negativity variable

egen words_1=rmean(Q69_1 Q69_3 Q69_5 Q69_6)
gen  words= (11-words_1)


***recodes control variables

gen pid =(7-Q39)

gen ideo= (Q40-1)

gen educ=(Q44-1)

generate female=0
replace female =1 if Q42==2 

generate age=Q43 if Q43 > 17

gen black=0
gen latino=0
replace black=1 if Q46==2
replace latino=1 if Q46==3

generate emot= (Q78_4-1)+(7-Q78_9)


*****Regression models

reg dv i.cell2 i.cell3 i.cell4 

reg dv c.words##i.cell2 c.words##i.cell3 C.words##i.cell4 

reg dv i.cell2 i.cell3 c.words##i.cell4

reg dv i.cell2 i.cell3 c.words##i.cell4 female educ age black latino ideo c.emot##c.words


